improvement(responsive): Select fluid + width-less controls keep size (CUI-36) - #1172
Conversation
Add a `fluid` prop to Select mirroring Input: the size-derived width becomes a preferred width (max-width:100%, min-width:0) that shrinks to fit its column instead of overflowing, and the menu widens to match. Fluid turns on automatically when the Select sits inside a `<Form responsive>` (read from the FormGroup FieldContext), so a responsive Form makes its Selects shrink with no per-field prop. Opt-in and non-breaking outside a responsive Form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mn (CUI-36) In a `responsive` Form with `helpErrorPosition="bottom"`, the field sits in a vertical Stack whose default `align-items: normal` (stretch) stretched a width-less control — a TextArea sized only by its `cols` — to fill the fluid `1fr` column. Left-align the field content in that case so the control keeps its intrinsic size. Input is unaffected (it caps via `max-width: 100%`), and the horizontal (help-on-right) layout and non-responsive forms are untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Hello jeanmarcmilletscality,My role is to assist you with the merge of this Available options
Available commands
Status report is not available. |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
… (CUI-36) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ve (CUI-32) A section with forceLabelWidth froze its label column to an exact pixel width, so in a responsive Form the label never shrank — only the field track did, until the row flipped to stacked. Treat forceLabelWidth as the column's upper bound instead: responsive wraps it in minmax(min-content, Npx) so the column keeps Npx while there is room and shrinks down to its longest word as the field is squeezed, with rows staying aligned. Non-responsive stays pinned to the exact width (unchanged). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
Waiting for approvalThe following approvals are needed before I can proceed with the merge:
Peer approvals must include at least 1 approval from the following list: |
|
/approve |
In the queueThe changeset has received all authorizations and has been added to the The changeset will be merged in:
There is no action required on your side. You will be notified here once IMPORTANT Please do not attempt to modify this pull request.
If you need this pull request to be removed from the queue, please contact a The following options are set: approve |
|
I have successfully merged the changeset of this pull request
Please check the status of the associated issue CUI-36. Goodbye jeanmarcmilletscality. |
TL;DR — Extends the responsive Form treatment beyond
Input: aSelectnow shrinks to fit its column (and auto-enables inside a<Form responsive>), and a width-less control such as aTextAreakeeps its intrinsic size in the fluid column instead of being stretched to fill it.Context
CUI-32 made
Form/Inputresponsive but, as documented there, onlyInputwas fluid —Select,SearchInput,TextAreakept their width and overflowed a shrinking column. CUI-36 is the follow-up that closes that gap for the remaining inputs. This PR is rebased onto the merged CUI-32 grid layout (its earlier stacked-on-CUI-32 history was dropped in favor of the final merged version).Approach
Selectfluid (selectv2). Add afluidprop mirroringInput: the size-derived width becomes a preferred width (max-width: 100%; min-width: 0) that shrinks to fit its column instead of overflowing, and the menu widens to match.fluidturns on automatically when the Select sits inside a<Form responsive>(read from the FormGroupFieldContext), so a responsive Form makes its Selects shrink with no per-field prop. Opt-in and non-breaking outside a responsive Form.Width-less controls keep their size (
form). WithhelpErrorPosition="bottom"the field sits in a vertical Stack whose defaultalign-items: normal(stretch) stretched a control sized only by itscols(aTextArea) to fill the fluid1frcolumn. The field content is now left-aligned in that case, so the control keeps its intrinsic size.Inputis unaffected (max-width: 100%); the horizontal (help-on-right) and non-responsive layouts are untouched.Review focus
selectv2/Selectv2.component.tsx—fluidplumbing + auto-on viauseFieldContext; confirm a Select outside a responsive Form is unchanged.selectv2/SelectStyle.ts—fluid→max-width: 100%; min-width: 0and menuwidth: 100%.form/Form.component.tsx—align-items: flex-startonly inresponsive+ non-righthelp position.How to test
responsive— aSelectshrinks with the column; aTextAreastays at itscolssize rather than stretching. Sanity-check a plainSelect(no Form) looks unchanged.npx jest src/lib/components/form src/lib/components/selectv2References